package cn.didi.feidi.javabackend.web.userapp.controller;

import cn.didi.feidi.javabackend.mysql.jpa.exception.MyException;
import cn.didi.feidi.javabackend.mysql.jpa.order.OrderUser;
import cn.didi.feidi.javabackend.mysql.jpa.response.ApiResponse;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.Random;
import java.util.UUID;

/**
 * Created by asus on 2017-07-20.
 */
@RestController
@RequestMapping("user")
public class UserController {

    private Random rand = new Random();

    @RequestMapping(method = RequestMethod.PUT)
    public ApiResponse<String> order(OrderUser orderUser) throws MyException {
        String orderId = getOrderIdByTimeStampAndRandom();
        return null;
    }

    public String getOrderIdByTimeStampAndRandom(){
        return String.valueOf(System.currentTimeMillis()) + String.valueOf(rand.nextInt(899999) + 100000);
    }

}
